﻿package mortal.game.view.arena.view
{
    import com.mui.controls.*;
    import extend.language.*;
    import flash.events.*;
    import mortal.common.global.*;
    import mortal.component.window.*;
    import mortal.game.manager.*;
    import mortal.game.view.common.*;
    import mortal.mvc.interfaces.*;

    public class ArenaTimerWin extends SmallWindow
    {
        private var _showInfo:GTextFiled;
        private var _confirmBtn:GButton;
        private var _leftTime:SecTimerView;
        private var _timeOutFunc:Function;
        private static var _instance:ArenaTimerWin;

        public function ArenaTimerWin(param1:ILayer = null)
        {
            super(LayerManager.topLayer);
            setSize(253, 215 - 20);
            title = Language.getString(40871);
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            _isAddClolseButton = false;
            super.createDisposedChildrenImpl();
            this._showInfo = UIFactory.gTextField("", 20 - 2, 63, 239, 50, this, GlobalStyle.textFormatBai.setSize(14));
            this._showInfo.wordWrap = true;
            this._showInfo.multiline = true;
            this._showInfo.htmlText = Language.getString(40872);
            this._confirmBtn = UIFactory.gButton("", 59 + 40, 162 + 6 - 20 + 5, 70 - 5, 27, this);
            this._confirmBtn.configEventListener(MouseEvent.CLICK, this.onClickHandler);
            return;
        }// end function

        private function timeOutHandler() : void
        {
            if (this._timeOutFunc != null)
            {
                this._timeOutFunc.call();
            }
            this.hide();
            return;
        }// end function

        override protected function configParams() : void
        {
            super.configParams();
            paddingBottom = 61 - 5;
            paddingLeft = 7;
            paddingRight = 7;
            return;
        }// end function

        private function onClickHandler(event:MouseEvent) : void
        {
            this.timeOutHandler();
            return;
        }// end function

        public function set timeOutFunc(param1:Function) : void
        {
            this._timeOutFunc = param1;
            return;
        }// end function

        override public function show(param1:int = 0, param2:int = 0) : void
        {
            super.show();
            this._leftTime = UIFactory.secTimeView(Language.getString(40873), 10, 2, 56, 22, this._confirmBtn);
            this._leftTime.setLeftTime(10);
            this._leftTime.timeOutHandler = this.timeOutHandler;
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl();
            this._showInfo.dispose();
            this._showInfo = null;
            this._confirmBtn.dispose();
            this._confirmBtn = null;
            this._leftTime.dispose();
            this._leftTime = null;
            this._timeOutFunc = null;
            return;
        }// end function

        public static function get instance() : ArenaTimerWin
        {
            if (_instance == null)
            {
                _instance = new ArenaTimerWin;
            }
            return _instance;
        }// end function

    }
}
